﻿using ControllerManageServer.ActionModel;
using ControllerManageServer.ActionModel.Aioi;
using DPS.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ControllerManageServer.LabelDevice.Aioi
{
    /// <summary>
    /// 无线标签
    /// </summary>
    class NW2991LabelDevice : BaseLabelDevice
    {
        public NW2991LabelDevice() {
            SeqLength = 5;
        }

        /// <summary>
        /// NW2991的标签的动作指令
        /// </summary>
        /// <param name="iModel">亮灯模式</param>
        /// <param name="iSeq">显示文本</param>
        /// <param name="iFnSeq"></param>
        /// <returns></returns>
        public override byte[] Action(ActionModelAbstract iModel, string iSeq, string iFnSeq = null) {
            List<byte> result = new List<byte>();

            result.AddRange(DefaultEncoding.GetBytes("FP1"));// 
            result.AddRange(DefaultEncoding.GetBytes("10"));// 长度
            result.AddRange(DefaultEncoding.GetBytes("0001"));
            result.AddRange(DefaultEncoding.GetBytes(Address));// 地址
            result.AddRange(DefaultEncoding.GetBytes("010"));
            result.AddRange(iModel.ModeArray());// LED
            if (iSeq == null) iSeq = "";
            result.AddRange(DefaultEncoding.GetBytes(SeqHandle(iSeq)));// 显示的数据

            return result.ToArray();
        }

        /// <summary>
        /// 获取电池电压
        /// </summary>
        /// <returns></returns>
        public override byte[] GetBatteryVoltage() {
            return DefaultEncoding.GetBytes($"FP1050001{Address}15000");
        }


    }
}
